/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.softmarket.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Marcelo
 */
@Entity
@Table(name = "ncm")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ncm.findAll", query = "SELECT n FROM Ncm n"),
    @NamedQuery(name = "Ncm.findByIdNcm", query = "SELECT n FROM Ncm n WHERE n.idNcm = :idNcm"),
    @NamedQuery(name = "Ncm.findByCodNcm", query = "SELECT n FROM Ncm n WHERE n.codNcm = :codNcm"),
    @NamedQuery(name = "Ncm.findByDescricaoNcm", query = "SELECT n FROM Ncm n WHERE n.descricaoNcm = :descricaoNcm")})
public class Ncm implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_ncm")
    private Integer idNcm;
    @Basic(optional = false)
    @Column(name = "cod_ncm")
    private int codNcm;
    @Basic(optional = false)
    @Column(name = "descricao_ncm")
    private String descricaoNcm;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ncmIdNcm")
    private List<Produto> produtoList;

    public Ncm() {
    }

    public Ncm(Integer idNcm) {
        this.idNcm = idNcm;
    }

    public Ncm(Integer idNcm, int codNcm, String descricaoNcm) {
        this.idNcm = idNcm;
        this.codNcm = codNcm;
        this.descricaoNcm = descricaoNcm;
    }

    public Integer getIdNcm() {
        return idNcm;
    }

    public void setIdNcm(Integer idNcm) {
        this.idNcm = idNcm;
    }

    public int getCodNcm() {
        return codNcm;
    }

    public void setCodNcm(int codNcm) {
        this.codNcm = codNcm;
    }

    public String getDescricaoNcm() {
        return descricaoNcm;
    }

    public void setDescricaoNcm(String descricaoNcm) {
        this.descricaoNcm = descricaoNcm;
    }

    @XmlTransient
    public List<Produto> getProdutoList() {
        return produtoList;
    }

    public void setProdutoList(List<Produto> produtoList) {
        this.produtoList = produtoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idNcm != null ? idNcm.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ncm)) {
            return false;
        }
        Ncm other = (Ncm) object;
        if ((this.idNcm == null && other.idNcm != null) || (this.idNcm != null && !this.idNcm.equals(other.idNcm))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.softmarket.modelo.Ncm[ idNcm=" + idNcm + " ]";
    }
    
}
